package com.cat.DataStructure04;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/minimum-number-of-operations-to-move-all-balls-to-each-box/
 * @create 2025/11/25 19:16
 * @since JDK17
 */

public class Solution12 {
    public int[] minOperations(String boxes) {
        char[] s = boxes.toCharArray();
        int n = s.length;
        int[] ans = new int[n];
        for (int i = 0; i < n; i++) {   //
            for (int j = 0; j < n; j++) {
                if (j != i && s[j] == '1') {    // 要搬过来
                    ans[i] += Math.abs(i - j);
                }
            }
        }

        return ans;
    }
}
